package com.xm.service.background;

import com.xm.dao.background.AdministratorDao;
import com.xm.entity.Administrator;
import com.xm.entity.AdministratorInformation;
import com.xm.exception.SqlErrorException;

import java.util.List;

/**
 * 管理员Service层
 * @author 康文程
 * @date 2023-12-15 下午 02:40
 */
public class AdministratorService {
    private final AdministratorDao dao = new AdministratorDao();

    public boolean isExistenceAdministrator(String id, String password) {
        return dao.checkAdministratorCredentials(id,password);
    }

    /**
     * 添加或修改员工
     * 如果传了getAdministratorId则修改没有则新增
     *
     * @param administrator 员工实体类
     * @throws SqlErrorException SQL执行异常
     */
    public boolean addAdministrator(Administrator administrator) throws SqlErrorException {
        return dao.addAdministrator(administrator);
    }

    /**
     * 查询账号
     * @return List集合
     */
    public List<Administrator> getId(){
        return dao.findId();
    }
}
